import { http, Method } from "@/utils/request.js";

/**
 * 添加交易投诉对话
 */
export function getBillPage(params) {
  return http.request({
    url: `/order/bill/getByPage`,
    method: Method.GET,
    params,
  });
}

/**
 * 获取所有物流公司
 */
export function getLogistics(params) {
  return http.request({
    url: `/other/logistics`,
    method: Method.GET,
    params,
  });
}

/**
 * 开启物流公司
 */
export function logisticsChecked(id) {
  return http.request({
    url: `/other/logistics/${id}`,
    method: Method.POST,
  });
}

/**
 * 关闭物流公司
 */
export function logisticsUnChecked(id) {
  return http.request({
    url: `/other/logistics/${id}`,
    method: Method.DELETE,
  });
}

/**
 * 获取商家详细信息
 */
export function getShopInfo() {
  return http.request({
    url: `/settings/storeSettings`,
    method: Method.GET,
  });
}

/**
 * 修改保存库存预警数
 */
export function updateStockWarning(params) {
  return http.request({
    url: `/settings/storeSettings/updateStockWarning`,
    method: Method.PUT,
    data: params,
    header: { "content-type": "application/x-www-form-urlencoded" },
  });
}

/**
 * 修改商家退货地址
 */
export function saveRefundGoodsAddress(params) {
  return http.request({
    url: `/settings/storeSettings/storeAfterSaleAddress`,
    method: Method.PUT,
    data: params,
    header: { "content-type": "application/x-www-form-urlencoded" },
  });
}

/**
 * 获取商家退货地址
 */
export function getRefundGoodsAddress(params) {
  return http.request({
    url: `/settings/storeSettings/storeAfterSaleAddress`,
    method: Method.GET,
  });
}

/**
 * 获取商家自提点
 */
export function getShopAddress(params) {
  return http.request({
    url: `/member/storeAddress/`,
    method: Method.GET,
    params,
  });
}

/**
 * 修改商家自提点
 */
export function editShopAddress(id, params) {
  return http.request({
    url: `/member/storeAddress/${id}`,
    method: Method.PUT,
    header: { "content-type": "application/x-www-form-urlencoded" },
    data: params,
  });
}

/**
 * 保存商家详细信息
 */
export function saveShopInfo(params) {
  return http.request({
    url: `/settings/storeSettings`,
    method: Method.PUT,
    header: { "content-type": "application/x-www-form-urlencoded" },
    data: params,
  });
}
/**
 * 获取当前店铺分类
 */
export function getShopGoodsLabelList(params) {
  return http.request({
    url: `/goods/label`,
    method: Method.GET,
    params,
  });
}

/**
 * 获取当前店铺分类
 */
export function addShopGoodsLabel(params) {
  return http.request({
    url: `/goods/label`,
    method: Method.POST,
    params,
  });
}



/**
 * 添加商品自提点
 */
 export function addShopAddress(params) {
  return http.request({
    url: `/member/storeAddress/`,
    method: Method.POST,
    header: { "content-type": "application/x-www-form-urlencoded" },
    data: params,
  });
}


/**
 * 删除商品自提点
 */
export function deleteShopAddress(params) {
  return http.request({
    url: `/member/storeAddress/${params.id}`,
    method: Method.DELETE,
    data: params,
  });
}

/**
 * 修改当前店铺分类
 */
export function editShopGoodsLabel(params) {
  return http.request({
    url: `/goods/label`,
    method: Method.PUT,
    header: { "content-type": "application/x-www-form-urlencoded" },
    data: params,
  });
}

/**
 * 删除店铺分类
 */
export function delShopGoodsLabel(id) {
  return http.request({
    url: `/goods/label/${id}`,
    method: Method.DELETE,
  });
}
